// let sex: string = '女'
// let sex: number = 5

// 字面量类型一般很少单独使用，都是使用字面量联合类型
type Sex = 0 | 1 | 2
// let sex: 0 | 1 | 2 = 0
let sex1: Sex = 0
let sex2: Sex = 1

let name1 = 'zhangsan'
name1 = 'lisi'
const name2 = 'zhangsan'

/**
function changeDirection (direction: 'up' | 'down' | 'left' | 'right') {
  switch (direction) {
    case 'up':
      break

    default:
      break
  }
}

function changeDirection2 (direction: 'up' | 'down' | 'left' | 'right') {
  switch (direction) {
    case 'up':
      break

    default:
      break
  }
}
 */

type Direction = 'up' | 'down' | 'left' | 'right'

function changeDirection (direction: Direction) {
  switch (direction) {
    case 'up':
      break

    case 'down':
      break

    default:
      break
  }
}

function changeDirection2 (direction: Direction) {
  switch (direction) {
    case 'up':
      break

    case 'left':
      break

    default:
      break
  }
}

changeDirection('left')

export {}
